package org.teremail.server;

import org.teremail.client.TableSelectionListener;

import com.google.gwt.junit.client.GWTTestCase;
import com.google.gwt.user.client.ui.FlexTable;

public class GwtTestTableSelectionListener extends GWTTestCase {

    public String getModuleName() {
        return "org.teremail.TestTereMailClient";
    }

    public void testSetSelection() {
        FlexTable ft = new FlexTable();
        TableSelectionListener tsl = TableSelectionListener.create(ft, 
                new int[] { 0 });
        ft.addTableListener(tsl);
        ft.setText(0, 0, "Row 0");
        ft.setText(1, 0, "Row 1");
        ft.setText(2, 0, "Row 2");
        tsl.onCellClicked(ft, 1, 0);
        String style = ft.getRowFormatter().getStyleName(1);
        assertNotNull(style, style);
        assertTrue(-1 != style.indexOf("selected"));
    }
}
